// D:\work\TopDFM_JNS\qt5.6.3-win32-msvc2015\topcam\topjs\3.4.0\bin\topjs3.exe
// 从tl解密脚本
var fs = require('fs');
var crypto = require('topsin.crypto');

var files = fs.listDir("./source")
 


files.forEach(function (file) {
    var baseName = file.baseName; // 
    var path = file.path; // 
    var content = fs.readFile(path)
    var encrypt = 2;
    if(content && content != "") {
        var retC = ""
        if (encrypt == 1) {
            retC = crypto.e(content);
        }
        else if (encrypt == 2) {
            retC = crypto.e2(content);
        }
        else if (encrypt == 3) {
            retC = crypto.e3(content);
        }

        if(!fs.exists("./dist")){
            fs.mkdir("./dist")
        }

        fs.writeFile("./dist/" + baseName + ".TL2", retC)
    }
})








